<?php
session_start();
if(!$_SESSION["trv3_07"]){
	header("location:../login.php");
	exit;
}
require "../resources/v1.php";
$conexion = server_reconnect();
$result = mysql_query( "select max(`id`) `maximo` from `oficios`", $conexion);
if( $mxcel = @mysql_fetch_array($result)){
	$ultimo_oficio = $mxcel['maximo'];
}
$conjunto = $ultimo_oficio.",".($ultimo_oficio - 1).",".($ultimo_oficio - 3).",".($ultimo_oficio - 7).",".($ultimo_oficio - 15).",".($ultimo_oficio - 31);
$query = "select `id`,`tipo`,`acta`,`est`,`doc` from `oficios` where `id` in (".$conjunto.")";
$result = mysql_query( $query, $conexion);
$index = 0;
echo '<html>';
echo 	'<head>';
echo 		'<script type="text/javascript">';
echo 			'function inicializar(){';
while( $mxcel = @mysql_fetch_array($result)){
	$link = "'http://www.tercerjuzgadofaltas.com.ar/sistema/oficios/cargarOficios.php?P01=".$mxcel['tipo']."&P02=".$mxcel['est']."&P03=".$mxcel['acta']."&P04=".$mxcel['id']."&P05=".$mxcel['doc']."','rsltFrame'";
	$demora = 2000 * $index;
	$index ++;
	echo 			'setTimeout( "window.open('.$link.')", '.$demora.');';
}
echo 			'}';
echo 		'</script>';
echo 	'</head>';
echo 	'<body onload="inicializar()">';
echo 	'</body>';
echo '</html>';
mysql_query( $query, $conexion);
server_disconnect( $conexion );
exit(0);
?>